<?php

/**
 * Subclass for performing query and update operations on the 'sql_statistic' table.
 *
 * 
 *
 * @package lib.model
 */ 
class SqlStatisticPeer extends BaseSqlStatisticPeer
{
	static function getStatistic($sqlString)
	{
		$resultSet = null;
		try {
			$resultSet = self::getDataNum($sqlString);
		}
		catch ( Exception  $e)
		{
			$resultSet = null;
		}
		return $resultSet;
	}
	
	static function getDataNum($sql, $db_schema = 'propel')
	{
	  $rs = null;
	  try {

			// Transaction support exists for (only?) Postgres, which must
			// have SELECT statements that include bytea columns wrapped w/
			// transactions.
			$con = Propel::getConnection($db_schema);
			$con->begin();
			$stmt = $con->prepareStatement($sql);
			$rs = $stmt->executeQuery(ResultSet::FETCHMODE_NUM);
			$con->commit();
			$stmt->close();
			//$con->close();
		} catch (Exception $e) {
			if ($stmt) $stmt->close();
			$con->rollback();
			Propel::log($e->getMessage(), Propel::LOG_ERR);
			throw new PropelException($e);
		}
		return $rs;
	}
}
